//package com.imooc.intercept;
//
//import com.imooc.base.BaseInfoProperties;
//import com.imooc.exceptions.GraceException;
//import com.imooc.grace.result.ResponseStatusEnum;
//import org.springframework.web.servlet.HandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//public class RedisTokenInterceptor extends BaseInfoProperties implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//
//        String userToken = request.getHeader("userToken");
//        String userId = request.getHeader("userId");
//
//        String value = redis.get(REDIS_USER_TOKEN + ":" + userId);
//
//        if(value == null|| !value.equals(userToken)){
//            GraceException.display(ResponseStatusEnum.UN_LOGIN);
//        }
//
//        return true;
//    }
//}
